package com.ruoyi.chat.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.chat.mapper.ChatLastMapper;
import com.ruoyi.chat.domain.ChatLast;
import com.ruoyi.chat.service.IChatLastService;

/**
 * 消息置顶Service业务层处理
 *
 * @author ch
 * @date 2021-11-19
 */
@Service
public class ChatLastServiceImpl implements IChatLastService
{
    @Autowired
    private ChatLastMapper chatLastMapper;

    /**
     * 查询消息置顶
     *
     * @param id 消息置顶主键
     * @return 消息置顶
     */
    @Override
    public ChatLast selectChatLastById(Long id)
    {
        return chatLastMapper.selectChatLastById(id);
    }

    /**
     * 查询消息置顶列表
     *
     * @param chatLast 消息置顶
     * @return 消息置顶
     */
    @Override
    public List<ChatLast> selectChatLastList(ChatLast chatLast)
    {
        return chatLastMapper.selectChatLastList(chatLast);
    }

    /**
     * 新增消息置顶
     *
     * @param chatLast 消息置顶
     * @return 结果
     */
    @Override
    public int insertChatLast(ChatLast chatLast)
    {
        chatLast.setCreateTime(DateUtils.getNowDate());
        return chatLastMapper.insertChatLast(chatLast);
    }

    /**
     * 修改消息置顶
     *
     * @param chatLast 消息置顶
     * @return 结果
     */
    @Override
    public int updateChatLast(ChatLast chatLast)
    {
        chatLast.setUpdateTime(DateUtils.getNowDate());
        return chatLastMapper.updateChatLast(chatLast);
    }

    /**
     * 批量删除消息置顶
     *
     * @param ids 需要删除的消息置顶主键
     * @return 结果
     */
    @Override
    public int deleteChatLastByIds(Long[] ids)
    {
        return chatLastMapper.deleteChatLastByIds(ids);
    }


    /**
     * 批量逻辑删除消息置顶
     *
     * @param ids 需要删除的消息置顶主键
     * @return 结果
     */
    @Override
    public int logicDeleteChatLast(Long[] ids,String delType,Long delUser)
    {
        return chatLastMapper.logicDeleteChatLast(ids,delType,delUser);
    }

    /**
     * 删除消息置顶信息
     *
     * @param id 消息置顶主键
     * @return 结果
     */
    @Override
    public int deleteChatLastById(Long id)
    {
        return chatLastMapper.deleteChatLastById(id);
    }
}
